/**
 */
package fUML.Syntax.CommonBehaviors.BasicBehaviors.util;

import fUML.Syntax.Classes.Kernel.util.KernelValidator;

import fUML.Syntax.CommonBehaviors.BasicBehaviors.*;

import java.util.Map;

import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.common.util.ResourceLocator;

import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.util.EObjectValidator;

/**
 * <!-- begin-user-doc -->
 * The <b>Validator</b> for the model.
 * <!-- end-user-doc -->
 * @see fUML.Syntax.CommonBehaviors.BasicBehaviors.BasicBehaviorsPackage
 * @generated
 */
public class BasicBehaviorsValidator extends EObjectValidator {
	/**
	 * The cached model package
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static final BasicBehaviorsValidator INSTANCE = new BasicBehaviorsValidator();

	/**
	 * A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.common.util.Diagnostic#getSource()
	 * @see org.eclipse.emf.common.util.Diagnostic#getCode()
	 * @generated
	 */
	public static final String DIAGNOSTIC_SOURCE = "fUML.Syntax.CommonBehaviors.BasicBehaviors";

	/**
	 * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'FUML empty body and language' of 'Opaque Behavior'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static final int OPAQUE_BEHAVIOR__FUML_EMPTY_BODY_AND_LANGUAGE = 1;

	/**
	 * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'FUML inactive' of 'Opaque Behavior'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static final int OPAQUE_BEHAVIOR__FUML_INACTIVE = 2;

	/**
	 * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'FUML reentrant behavior' of 'Behavior'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static final int BEHAVIOR__FUML_REENTRANT_BEHAVIOR = 3;

	/**
	 * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'FUML allowed owned behaviors' of 'Behaviored Classifier'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static final int BEHAVIORED_CLASSIFIER__FUML_ALLOWED_OWNED_BEHAVIORS = 4;

	/**
	 * A constant with a fixed name that can be used as the base value for additional hand written constants.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 4;

	/**
	 * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT;

	/**
	 * The cached base package validator.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected KernelValidator kernelValidator;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BasicBehaviorsValidator() {
		super();
		kernelValidator = KernelValidator.INSTANCE;
	}

	/**
	 * Returns the package of this validator switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EPackage getEPackage() {
	  return BasicBehaviorsPackage.eINSTANCE;
	}

	/**
	 * Calls <code>validateXXX</code> for the corresponding classifier of the model.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) {
		switch (classifierID) {
			case BasicBehaviorsPackage.OPAQUE_BEHAVIOR:
				return validateOpaqueBehavior((OpaqueBehavior)value, diagnostics, context);
			case BasicBehaviorsPackage.BEHAVIOR:
				return validateBehavior((Behavior)value, diagnostics, context);
			case BasicBehaviorsPackage.BEHAVIORED_CLASSIFIER:
				return validateBehavioredClassifier((BehavioredClassifier)value, diagnostics, context);
			case BasicBehaviorsPackage.FUNCTION_BEHAVIOR:
				return validateFunctionBehavior((FunctionBehavior)value, diagnostics, context);
			case BasicBehaviorsPackage.CALL_CONCURRENCY_KIND:
				return validateCallConcurrencyKind((CallConcurrencyKind)value, diagnostics, context);
			default:
				return true;
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateOpaqueBehavior(OpaqueBehavior opaqueBehavior, DiagnosticChain diagnostics, Map<Object, Object> context) {
		if (!validate_NoCircularContainment(opaqueBehavior, diagnostics, context)) return false;
		boolean result = validate_EveryMultiplicityConforms(opaqueBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryDataValueConforms(opaqueBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(opaqueBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(opaqueBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryProxyResolves(opaqueBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_UniqueID(opaqueBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryKeyUnique(opaqueBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(opaqueBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validateBehavioredClassifier_fUML_allowed_owned_behaviors(opaqueBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= kernelValidator.validateClass_active_class_classifier_behavior(opaqueBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= kernelValidator.validateClass_active_class_specialization(opaqueBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= kernelValidator.validateClass_abstract_class(opaqueBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validateBehavior_fUML_reentrant_behavior(opaqueBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validateOpaqueBehavior_fUML_empty_body_and_language(opaqueBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validateOpaqueBehavior_fUML_inactive(opaqueBehavior, diagnostics, context);
		return result;
	}

	/**
	 * Validates the fUML_empty_body_and_language constraint of '<em>Opaque Behavior</em>'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateOpaqueBehavior_fUML_empty_body_and_language(OpaqueBehavior opaqueBehavior, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return opaqueBehavior.fUML_empty_body_and_language(diagnostics, context);
	}

	/**
	 * Validates the fUML_inactive constraint of '<em>Opaque Behavior</em>'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateOpaqueBehavior_fUML_inactive(OpaqueBehavior opaqueBehavior, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return opaqueBehavior.fUML_inactive(diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateBehavior(Behavior behavior, DiagnosticChain diagnostics, Map<Object, Object> context) {
		if (!validate_NoCircularContainment(behavior, diagnostics, context)) return false;
		boolean result = validate_EveryMultiplicityConforms(behavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryDataValueConforms(behavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(behavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(behavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryProxyResolves(behavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_UniqueID(behavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryKeyUnique(behavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(behavior, diagnostics, context);
		if (result || diagnostics != null) result &= validateBehavioredClassifier_fUML_allowed_owned_behaviors(behavior, diagnostics, context);
		if (result || diagnostics != null) result &= kernelValidator.validateClass_active_class_classifier_behavior(behavior, diagnostics, context);
		if (result || diagnostics != null) result &= kernelValidator.validateClass_active_class_specialization(behavior, diagnostics, context);
		if (result || diagnostics != null) result &= kernelValidator.validateClass_abstract_class(behavior, diagnostics, context);
		if (result || diagnostics != null) result &= validateBehavior_fUML_reentrant_behavior(behavior, diagnostics, context);
		return result;
	}

	/**
	 * Validates the fUML_reentrant_behavior constraint of '<em>Behavior</em>'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateBehavior_fUML_reentrant_behavior(Behavior behavior, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return behavior.fUML_reentrant_behavior(diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateBehavioredClassifier(BehavioredClassifier behavioredClassifier, DiagnosticChain diagnostics, Map<Object, Object> context) {
		if (!validate_NoCircularContainment(behavioredClassifier, diagnostics, context)) return false;
		boolean result = validate_EveryMultiplicityConforms(behavioredClassifier, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryDataValueConforms(behavioredClassifier, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(behavioredClassifier, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(behavioredClassifier, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryProxyResolves(behavioredClassifier, diagnostics, context);
		if (result || diagnostics != null) result &= validate_UniqueID(behavioredClassifier, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryKeyUnique(behavioredClassifier, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(behavioredClassifier, diagnostics, context);
		if (result || diagnostics != null) result &= validateBehavioredClassifier_fUML_allowed_owned_behaviors(behavioredClassifier, diagnostics, context);
		return result;
	}

	/**
	 * Validates the fUML_allowed_owned_behaviors constraint of '<em>Behaviored Classifier</em>'.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateBehavioredClassifier_fUML_allowed_owned_behaviors(BehavioredClassifier behavioredClassifier, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return behavioredClassifier.fUML_allowed_owned_behaviors(diagnostics, context);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateFunctionBehavior(FunctionBehavior functionBehavior, DiagnosticChain diagnostics, Map<Object, Object> context) {
		if (!validate_NoCircularContainment(functionBehavior, diagnostics, context)) return false;
		boolean result = validate_EveryMultiplicityConforms(functionBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryDataValueConforms(functionBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(functionBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(functionBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryProxyResolves(functionBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_UniqueID(functionBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryKeyUnique(functionBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(functionBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validateBehavioredClassifier_fUML_allowed_owned_behaviors(functionBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= kernelValidator.validateClass_active_class_classifier_behavior(functionBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= kernelValidator.validateClass_active_class_specialization(functionBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= kernelValidator.validateClass_abstract_class(functionBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validateBehavior_fUML_reentrant_behavior(functionBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validateOpaqueBehavior_fUML_empty_body_and_language(functionBehavior, diagnostics, context);
		if (result || diagnostics != null) result &= validateOpaqueBehavior_fUML_inactive(functionBehavior, diagnostics, context);
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean validateCallConcurrencyKind(CallConcurrencyKind callConcurrencyKind, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return true;
	}

	/**
	 * Returns the resource locator that will be used to fetch messages for this validator's diagnostics.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public ResourceLocator getResourceLocator() {
		// TODO
		// Specialize this to return a resource locator for messages specific to this validator.
		// Ensure that you remove @generated or mark it @generated NOT
		return super.getResourceLocator();
	}

} //BasicBehaviorsValidator
